function handleStatementsAndDocumentsPageCore(page, month, year)
{
    var tblUiFormatting;
    var tblStatements;
    var arrRows;

    // Get the table containing the HTML formatted statement data
    tblUiFormatting = document.getElementById("_ctl0_MainContentPlaceHolder_tblConsolidatedStatements");
    if (!validateControls(page.moniker, [tblUiFormatting])) return;

    // The UI formatting table is itself not interesting but it should contain only
    // one child table and that one child table should contain the interesting data.
    // Get that child table.
    {
        var tableElements = tblUiFormatting.getElementsByTagName("table");
        assert((1 == tableElements.length), "tblUiFormatting has more children than expected");
        
        tblStatements = tableElements[0];
    }
    if (!validateControls(page.moniker, [tblStatements])) return;

    arrRows = nodeListToArray(tblStatements.rows);
    if (!validateControls(page.moniker, [arrRows])) return;
    
    if (!isYearExpanded(arrRows, year))
    {
        toggleYearFolding(arrRows, year);
    }
    else
    {
        onYearExpandCompleted(page, arrRows, month, year);
    }
}

function handleStatementsAndDocumentsPage(page)
{
    var d = new Date();
    var currentMonth = d.getMonth();
    var lastMonth = currentMonth - 1;
    var monthName = getMonthAsName(lastMonth);
    var year = d.getFullYear();
    handleStatementsAndDocumentsPageCore(page, monthName, year);
}
